package com.atguigu.srb.rabbitutil.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class MQService {
    @Resource
    private RabbitTemplate rabbitTemplate;

    // 发送消息
    public void mqSendMessage(String exchange, String routingKey, Object message) {
        log.info("发送消息......");
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
    }


}
